﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class city1 : System.Web.UI.Page
{
    int no;

    protected void Page_Load(object sender, EventArgs e)
    {

        no = int.Parse(Request["no"]);
        int typeno=int.Parse(Request["type"]);
        ctpDataContext db = new ctpDataContext();
        //ct_profile ct = db.ct_profiles.Single(p => p.no == no && p.language_no == (int)Session["now_user_lang_no"]);


        var cts = from p in db.ct_s_profiles
                  where p.valid == true && p.ct_no == no && p.language_no == (int)Session["now_user_lang_no"]&&p.type_no==typeno
                  orderby p.ranking descending
                  select p;


        //this.HyperLink7.NavigateUrl = "city.aspx?no=" + no.ToString();
        //this.HyperLink7.Text = ct.title.Trim() + " home";

        foreach (ct_s_profile c in cts)
        {
            if (c.main_pic_fn == null)
                c.main_pic_fn = "coming.gif";
            else
            {
                c.main_pic_fn = c.main_pic_fn.Trim();
            }
            //c.title = c.title.Substring(0, 9);

        }

        this.GridView1.DataSource = cts;

        var type = from p in db.ct_s_types
                   where p.language_no == (int)Session["now_user_lang_no"]
                   orderby p.no descending
                   select new
                   {
                       title = p.title,
                       to = "city1.aspx?type=" + p.no + "&no=" + no.ToString()

                   };


        this.DataList1.DataSource = type;


        this.DataBind();
    }
}
